<template>
	<view class="container">
		<view class="break-list">
			<view class="break-item" v-for="(item, index) in 20" :key="index" @click="goBreak(index)">
				<text>第{{index+1}}关</text>
				<view class="current" v-if="current == index + 1">
					<text>当前学习</text>
				</view>
				<view class="current" v-if="current > index + 1">
					<text>已通关</text>
				</view>
				<view class="close" v-if="current != index + 1 && current < index + 1">
					<image src="/static/icons/close.png" mode=""></image>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				current: 2
			}
		},
		methods: {
			goBreak(index){
				if(index+1 > this.current){
					uni.showModal({
						title:"提示",
						content: '该关卡未解锁'
					})
					return;
				}
				uni.navigateTo({
					url: './breakPaper/breakPaper'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.container{
		padding: 30rpx;
		.break-list{
			display: grid;
			grid-template-columns: 1fr 1fr 1fr;
			.break-item{
				width: 200rpx;
				height: 200rpx;
				background-color: rgba($color: #ecf5ff, $alpha: 0.4);
				margin-bottom: 30rpx;
				border-radius: 16rpx;
				box-sizing: border-box;
				display: flex;
				padding: 30rpx;
				flex-direction: column;
				justify-content: space-around;
				align-items: center;
				color: #333;
				.current{
					font-size: 28rpx;
					color: #53a8ff;
				}
				.close{
					image{
						width: 45rpx;
						height: 45rpx;
					}
				}
			}
		}
	}
</style>
